/** 
 * Project Name:jd-orm 
 * File Name:IBaseJdbcDao.java 
 * Package Name:com.jd.orm.framework.core.dao 
 * Date:2014-5-13上午11:25:43 
 * Copyright (c) 2014, liubing1@jd.com All Rights Reserved. 
 * 
 */

package com.jd.orm.framework.core.dao;

import java.io.Serializable;
import java.util.List;
import java.util.Map;
import com.jd.orm.framework.core.entity.BaseEntity;
import com.jd.orm.framework.core.transaction.JdbcSession;
import com.jd.orm.framework.core.util.PageResult;
import com.jd.orm.framework.core.util.QueryCriteria;
import com.jd.orm.framework.core.validate.DefaultOrmValidateImpl;

/**
 * ClassName: IBaseJdbcDao <br/>
 * Function: TODO ADD FUNCTION. <br/>
 * Reason: TODO ADD REASON. <br/>
 * date: 2014-5-13 上午11:25:43 <br/>
 * 
 * @author liubing1@jd.com
 * @version
 * @since up JDK 1.5
 */

public interface IBaseDao<T extends BaseEntity> {
	/**
	 * 
	 * doCreateEntity: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param t
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public void doCreateEntity(JdbcSession jdbcSession, T t) throws Exception;
	/**
	 * 
	 * doCreateEntity: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param t
	 * @param defaultOrmValidateImpl
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public void doCreateEntity(JdbcSession jdbcSession, T t,
			DefaultOrmValidateImpl defaultOrmValidateImpl) throws Exception;
	/**
	 * 
	 * doCreateBySql: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param sql
	 * @param params
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public void doCreateBySql(JdbcSession jdbcSession, String sql,
			Object... params) throws Exception;
	/**
	 * 
	 * doUpdateEntity: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param t
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public void doUpdateEntity(JdbcSession jdbcSession, T t) throws Exception;
	/**
	 * 
	 * doUpdateEntity: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param t
	 * @param defaultOrmValidateImpl
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public void doUpdateEntity(JdbcSession jdbcSession, T t,
			DefaultOrmValidateImpl defaultOrmValidateImpl) throws Exception;
	/**
	 * 
	 * doUpdateBySql: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param sql
	 * @param params
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public void doUpdateBySql(JdbcSession jdbcSession, String sql,
			Object... params) throws Exception;
	/**
	 * 
	 * doRemoveEntity: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param t
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public void doRemoveEntity(JdbcSession jdbcSession, T t) throws Exception;
	/**
	 * 
	 * doRemoveBySql: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param sql
	 * @param params
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public void doRemoveBySql(JdbcSession jdbcSession, String sql,
			Object... params) throws Exception;
	/**
	 * 
	 * findById: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param id
	 * @return
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public T findById(JdbcSession jdbcSession, Serializable id)
			throws Exception;
	/**
	 * 
	 * findAll: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @return
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public List<T> findAll(JdbcSession jdbcSession) throws Exception;
	/**
	 * 
	 * findByBean: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param t
	 * @return
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public List<T> findByBean(JdbcSession jdbcSession, T t) throws Exception;
	/**
	 * 
	 * findByMap: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param params
	 * @return
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public List<T> findByMap(JdbcSession jdbcSession, Map<String, Object> params)
			throws Exception;
	/**
	 * 
	 * findReturnClassByParamsAndSql: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param sql
	 * @param returnentityclass
	 * @param params
	 * @return
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public List<T> findReturnClassByParamsAndSql(JdbcSession jdbcSession,
			String sql, Class<?> returnentityclass, Object... params)
			throws Exception;
	/**
	 * 
	 * findReturnObjectByParamsAndSql: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param sql
	 * @param cls
	 * @param params
	 * @return
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public Object findReturnObjectByParamsAndSql(JdbcSession jdbcSession,
			String sql, Class<?> cls, Object... params) throws Exception;
	/**
	 * 
	 * findAsInt: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param sql
	 * @param parameters
	 * @return
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public Integer findAsInt(JdbcSession jdbcSession, String sql,
			Object... parameters) throws Exception;
	/**
	 * 
	 * findAsLong: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param sql
	 * @param parameters
	 * @return
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public Long findAsLong(JdbcSession jdbcSession, String sql,
			Object... parameters) throws Exception;
	/**
	 * 
	 * findAsFloat: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param sql
	 * @param parameters
	 * @return
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public Float findAsFloat(JdbcSession jdbcSession, String sql,
			Object... parameters) throws Exception;
	/**
	 * 
	 * findAsString: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param sql
	 * @param parameters
	 * @return
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public String findAsString(JdbcSession jdbcSession, String sql,
			Object... parameters) throws Exception;
	/**
	 * 
	 * findAsMap: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param sql
	 * @param parameters
	 * @return
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public Map<String, Object> findAsMap(JdbcSession jdbcSession, String sql,
			Object... parameters) throws Exception;
	/**
	 * 
	 * findByCriteria: <br/> 
	 * TODO.<br/> 
	 * @author liubing1@jd.com
	 * @param jdbcSession
	 * @param queryCriteria
	 * @return
	 * @throws Exception 
	 * @since JDK 1.5
	 */
	public PageResult<T> findByCriteria(JdbcSession jdbcSession,
			QueryCriteria queryCriteria) throws Exception;
	/**
	 * 
	 * @param jdbcSession
	 * @param sql
	 * @param parameters
	 * @return
	 * @throws Exception
	 */
	public int[] executeBatch(JdbcSession jdbcSession, String sql,
			List<Object[]> parameters) throws Exception;
}
